package export.magicWeapon
{
	import base.BaseAddEffect;
	import base.BaseBitmapDataClip;
	import base.BaseBitmapDataPool;
	import base.BaseHero;
	import base.BaseMagicWeapon;
	
	import com.game.data.vo.EquipmentVO;
	import com.greensock.TweenMax;
	
	import flash.geom.Point;
	
	public class MagicYXFB extends BaseMagicWeapon
	{
		
		public function MagicYXFB(bo:BaseHero)
		{
			super(bo);
			this.mp = 10;
		}
		
		override protected function initBBDC():void
		{
			var body:* = null;
			var bmdArray:Array = BaseBitmapDataPool.getBitmapDataArrayByName("MagicLXFBBmd");
			if (bmdArray)
			{
				body = {
					"name"  : "body",
					"source": bmdArray
				};
				bbdc = new BaseBitmapDataClip([body], 61, 50, new Point(0, 0));
				bbdc.setOffsetXY(1, -10);
				bbdc.setFrameStopCount([[10], [9999]]);
				bbdc.setFrameCount([1, 1]);
				bbdc.setAddScriptWhenFrameOver(scriptFrameOverFunc);
				this.addChild(bbdc);
				return;
			}
			throw new Error("MagicYXFBBmd--BitmapData Error!");
		}
		
		override public function showSkill():void
		{
			var timeCount:uint = 0;
			var equip:EquipmentVO = null;
			if (this.sourceRole)
			{
				this.sourceRole.reduceHp(sourceRole.getHpMax() / 2);
				timeCount = gc.frameClips * 8;
				equip = this.sourceRole.getPlayer().getCurEquipByType("zbfb");
				if (equip && equip.getFiveElementString().indexOf("木") != -1)
				{
					timeCount *= 2;
				}
				this.sourceRole.addCurAddEffect([{
					"name": BaseAddEffect.YXFB_BUFF,
					"time": timeCount
				}]);
				TweenMax.delayedCall(21, function (_self:MagicYXFB):*
				{
					_self.setAction("idle");
				}, [this]);
			}
		}
		
		override public function destroy():void
		{
			if (this.sourceRole && false)
			{
				if (this.sourceRole.curAddEffect)
				{
//					this.sourceRole.curAddEffect.removeEffectByType(BaseAddEffect.YXFB_BUFF);
				}
			}
			super.destroy();
		}
	}
}
